package com.mybook.app.controller;

import com.mybook.app.core.BaseResponse;
import com.mybook.app.request.CityRequest;
import com.mybook.app.response.City;
import com.mybook.app.response.FileUpload;
import com.mybook.app.service.CommonService;
import com.mybook.app.service.FileUtilsService;
import com.mybook.app.utils.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/***
 *
 *文件上传类
 *
 */

@RestController
@RequestMapping("/common")
public class CommonController {
    @Autowired
    private CommonService commonService;

    /**
     * 关键字查找城市列表
     *
     * @param
     * @param
     * @return
     * @throws IOException
     */
    @PostMapping("/city")
    public BaseResponse city(@RequestBody CityRequest cityRequest) {
        Logger.info(this, "城市获取");
        List<City> cities = commonService.city(cityRequest.getKeyword());
        return new BaseResponse(cities);
    }
}